package com.wn.main.ui.category.viewmodel

import com.wn.common.model.CategoryItem
import com.wn.main.ui.category.repository.CategoryRepository
import com.wn.network.viewmodel.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.StateFlow
import javax.inject.Inject

/**
 * @Author: wn
 * @Date: 2025/2/11 16:31
 * @Description: 分类 ViewModel
 */
@HiltViewModel
class CategoryViewModel @Inject constructor(private val repository: CategoryRepository) :
  BaseViewModel() {
  /**
   * 获取分类信息
   * @return StateFlow<MutableList<CategoryItem>?>
   */
  fun getCategoryData(): StateFlow<MutableList<CategoryItem>?> =
    callBaseRequest({ scope, errorCall, showLoading ->
      repository.getCategoryData(
        scope,
        errorCall,
        showLoading
      )
    }, true)
}